#include "stdio.h"




int main(){
	int arr[10] = {-2,11,-4,13,-5,2,-5,-3,12,9};
	int start_index = 0;
	int end_index = 10;
	int max_sum = 0;
	int max_start = 0;
	int max_end = 0;


	for(start_index=0;start_index<end_index;start_index++){
		int sum_tmp = 0;
		for(int i = start_index;i<end_index;i++){
			sum_tmp += arr[i];

			printf("%d to %d SUM = %d \n",start_index,i,sum_tmp);
			if(sum_tmp > max_sum){

				max_start = start_index;
				max_end = i;

				printf("max_arr is %d to %d ,SUM=%d > %d \n",max_start,max_end,sum_tmp,max_sum);

				max_sum = sum_tmp;


			}
		}
	}

	printf("max_arr is %d to %d ,SUM=%d \n",max_start,max_end,max_sum);


	return 1;
}
